package com.clement.factory.simple;

import org.springframework.stereotype.Component;

/**
 * Created by Clement on 2017/6/13.
 */
@Component
public class HumanFactory extends AbstractHumanFactory {
    @Override
    public <T extends IHuman> IHuman createHuman(Class<T> tClass) {
        IHuman human = null;
        try {
            human = (IHuman) Class.forName(tClass.getName()).newInstance();
        } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) {
            e.printStackTrace();
        }
        return human;
    }
}
